package controller.room
{
	
	import events.room.EventSetTilesProperty;
	import events.room.EventTilesPropertyChanged;
	
	import model.ModelProject;
	import model.ModelSelection;
	
	import org.robotlegs.mvcs.Command;
	
	import others.Util;
	
	public class CommandSetTilesProperty extends Command
	{
		[Inject]
		public var event:EventSetTilesProperty;
		
		[Inject]
		public var mp:ModelProject;
		
		override public function execute() : void {
			mp.projectModified = true;

			var i:uint;
			for (i = 0; i < event.tiles.length; i++){
				Util.setCascadePropery(event.tiles[i], event.property, event.value);
			}
			dispatch(new EventTilesPropertyChanged(EventTilesPropertyChanged.TILES_PROPERTIES_CHANGED));
		}
	}
}